from nameko.standalone.rpc import ClusterRpcProxy


# MQ配置
config_mq = {'AMQP_URI': "amqp://guest:guest@localhost:5672"}

def call_service():
    with ClusterRpcProxy(config_mq) as rpc:
        # 消费者调用微服务(生产者)，获取服务(生产者)的返回值
        # rpc.服务名.方法名
        result = rpc.generate_service.hello_world(msg="xag msg")
        print(result)
        # 返回结果
        return result, 200
if __name__ == '__main__':
    call_service()

